﻿Public Class FrmBrowse

    Sub New()
        InitializeComponent()
        List.Columns("kimlik").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        View.SelectedIndex = 0
    End Sub

    Sub Populate()
        Q("select distinct kimlik,adi,soyadi from istihdam")
        Select Case View.SelectedIndex
            Case 0 : Q("where convert(char(6),basvurutar,112) = '" & Today.ToString("yyyyMM") & "'")
            Case 1 : Q("where convert(char(6),basvurutar,112) = '" & Today.AddMonths(-1).ToString("yyyyMM") & "'")
        End Select
        Q("order by adi,soyadi")
        Dim Rs = OpenSQL("*")
        List.DataSource = Rs
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click
        DialogResult = Windows.Forms.DialogResult.Cancel
        Close()
    End Sub

    Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
        DialogResult = Windows.Forms.DialogResult.OK
        Close()
    End Sub

    Private Sub List_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles List.DoubleClick
        BtnOK.PerformClick()
    End Sub

    Private Sub View_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles View.SelectedIndexChanged
        Populate()
    End Sub

    Private Sub List_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles List.KeyDown
        If e.KeyData = Keys.Enter Then
            BtnOK.PerformClick()
            e.Handled = True
        End If
    End Sub

End Class